package kr.saeildamil.androidforstudy2.ch24;

import kr.saeildamil.androidforstudy2.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;

public class LayoutAnimation extends Activity {
	LinearLayout layout;
	int mCount = 1;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch24_layoutanimation);
		
		layout = (LinearLayout) findViewById(R.id.ch24_layoutanimation_layout);
		
	}

	public void mOnClick(View v){
		Button btn = new Button(this);
		btn.setText("B" + mCount);
		mCount ++;
		btn.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
			layout.removeView(v);
			}
		});
		layout.addView(btn);
	}	
}
